//
//  DCViewController.m
//  XXXXX
//
//  Created by point on 2018/1/15.
//  Copyright © 2018年 whiteboard. All rights reserved.
//

#import "DCViewController.h"
#import "One.h"
#import "Two.h"
#import "DCTool.h"
#import "WHOViewController.h"
#import <ReactiveObjC.h>

@interface DCViewController ()

@property(nonatomic,strong) One *one;

@property(nonatomic,strong) NSString *lalal;
@property(nonatomic,strong) UIButton *btn;

@property(nonatomic,assign) NSInteger a;
//@property(nonatomic,strong) Two *two;
@property(nonatomic,strong) void(^zzzblock)(void);
@end

@implementation DCViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.btn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btn.frame = CGRectMake(100, 100, 300, 50);
    [self.view addSubview:self.btn];
    self.btn.backgroundColor = [UIColor redColor];
    @weakify(self)
    [[self.btn rac_signalForControlEvents:UIControlEventTouchUpInside]subscribeNext:^(__kindof UIControl * _Nullable x) {
         @strongify(self)
        //[self haha];
        self.a = 100;
        
        
        void(^block)(void) = ^(){
            self.a = 100;    //这里block 对self 进行了引用
        };

        self.zzzblock = block; //这里 self 对block 进行了引用 所以就会造成循环引用
    }];
    
    
    
   // WHOViewController *vc = [[WHOViewController alloc]init];
   // [[DCTool shareCamera]install:vc];
    //self.one = [[One alloc]init];
    //self.one.vc = self;
//    self.two = [[Two alloc]init];
//  
//   self.one.two =  self.two;
//    self.two.one = self.one;
   // [DCTool shareCamera].two.zhao = @"122";
    // Do any additional setup after loading the view from its nib.
    
    
    
}

- (void)haha {
     self.lalal = @"ffff";
}




- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
    [self dismissViewControllerAnimated:true completion:nil];
}


- (void)dealloc {
    
    //str1.retainCount)
   // NSLog(@"%lu",(unsigned long)self.retainCount);
    
    NSLog(@"DCViewController 释放");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
